package com.xiaojf.xlog.appender.es.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

import java.io.Serializable;

/**
 * 访问日志
 *
 * @author Ade.Xiao 2021/3/12 11:25
 */
@Document(indexName = "xlog-accesslog-*", shards = 1, replicas = 0, refreshInterval = "30s")
public class AccessLog implements Serializable {
    private static final long serialVersionUID = -724694266832788492L;
    @Id
    private String id;
    /**
     * 请求uri
     */
    @Field(name = "uri")
    private String uri;
    /**
     * ip地址
     */
    @Field(name = "ip")
    private String ip;
    /**
     * 访问时间
     */
    @Field(name = "accessTime")
    private Long accessTime;
    /**
     * 耗时
     */
    @Field(name = "appendTime")
    private Long appendTime;
    /**
     * 日志内容
     */
    @Field(name = "content")
    private String content;

    /**
     * 请求是否成功
     */
    @Field(name = "successful")
    private boolean successful = true;

    /**
     * 错误日志
     */
    @Field(name = "error")
    private String error;

    /**
     * 操作类型
     */
    @Field(name = "operate_type")
    private String operateType;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Long getAccessTime() {
        return accessTime;
    }

    public void setAccessTime(Long accessTime) {
        this.accessTime = accessTime;
    }

    public Long getAppendTime() {
        return appendTime;
    }

    public void setAppendTime(Long appendTime) {
        this.appendTime = appendTime;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isSuccessful() {
        return successful;
    }

    public void setSuccessful(boolean successful) {
        this.successful = successful;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getOperateType() {
        return operateType;
    }

    public void setOperateType(String operateType) {
        this.operateType = operateType;
    }
}
